﻿#查找路径下面所有源文件
aux_source_directory(. SRC_LIST)

SET(SPD_SRC ${CMAKE_CURRENT_SOURCE_DIR})
file(GLOB MAIN_HEADER_FILES ${SPD_SRC}/*.hpp)
file(GLOB SPD_HEADER_FILES ${SPD_SRC}/spdlog/*.h)
file(GLOB SPD_HEADER_FILES_DETAILS ${SPD_SRC}/spdlog/details/*.h)
file(GLOB SPD_HEADER_FILES_FMT ${SPD_SRC}/spdlog/fmt/*.h)
file(GLOB SPD_HEADER_FILES_FMT_BUNDLED ${SPD_SRC}/spdlog/fmt/bundled/*.h ${SPD_SRC}/spdlog/fmt/bundled/*.cc)
file(GLOB SPD_HEADER_FILES_SINKS ${SPD_SRC}/spdlog/sinks/*.h)


#设置debug项目名后缀
set(CMAKE_DEBUG_POSTFIX "_gd")

#引用当前文件夹
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/spdlog)

#设置预处理
add_definitions(-DXTTO_EXPORTS)

#设置静态库
add_library(commonLibSpdLog STATIC ${SRC_LIST})

#设置预编译
SET_TARGET_PROPERTIES(commonLibSpdLog PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "stdafx.h")
cotire(commonLibSpdLog)

#设置目录
set_target_properties(commonLibSpdLog PROPERTIES FOLDER "CommonLib")

#复制头文件到inchhvi
install(FILES ${MAIN_HEADER_FILES} DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/include/spdlog COMPONENT headers)
install(FILES ${SPD_HEADER_FILES} DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/include//spdlog COMPONENT headers)
install(FILES ${SPD_HEADER_FILES_DETAILS} DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/include/spdlog/details COMPONENT headers)
install(FILES ${SPD_HEADER_FILES_FMT} DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/include/spdlog/fmt/ COMPONENT headers)
install(FILES ${SPD_HEADER_FILES_FMT_BUNDLED} DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/include/spdlog/fmt/bundled COMPONENT headers)
install(FILES ${SPD_HEADER_FILES_SINKS} DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/include/spdlog/sinks COMPONENT headers)

install(TARGETS commonLibSpdLog 
        RUNTIME DESTINATION ${PROJECT_BINARY_DIR}/bin
		ARCHIVE DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/lib)




